package com.doit.demo03;

public class test_sleep {
    public static void main(String[] args) throws InterruptedException {
//        for (int i = 0; i < 50; i++) {
//            Thread.sleep(1000);//毫秒;
//            System.out.println(i);
//        }
       Thread t1 = new Thread(new Runnable() {
           @Override
           public void run() {
               for (int i = 0; i < 10000; i++) {
                   System.out.println(Thread.currentThread().getName()+" "+i);
               }
           }
       });
       Thread t2 = new Thread(new Runnable() {
           @Override
           public void run() {
               for (int i = 0; i < 10000; i++) {
                   System.out.println(Thread.currentThread().getName()+" "+i);
               }
           }
       });

        t1.setPriority(Thread.MAX_PRIORITY);
        t2.setPriority(Thread.MIN_PRIORITY);
//        t1.setDaemon(true);
        t1.start();
        t2.start();

//        for (int i = 0; i < 10000; i++) {
//            Thread.sleep(1000);
//            System.out.println(Thread.currentThread().getName()+" "+i);
//        }
    }
}
